# Maintainer: Renato Silva <br.renatosilva@gmail.com>

_realname='purple-skypeweb'
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.1
pkgrel=2
pkgdesc='Skype plugin for libpurple (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
url='https://github.com/EionRobb/skype4pidgin/tree/master/skypeweb'
license=('spdx:GPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-gettext"
         "${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-json-glib"
         "${MINGW_PACKAGE_PREFIX}-pidgin"
         "${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             'rsync')
source=("https://github.com/EionRobb/skype4pidgin/archive/${pkgver}/skype4pidgin-${pkgver}.tar.gz"
        Makefile)
sha256sums=('e1c3c07fa2ed82500b8a14045bd5d59e893002dbbeb66ade7ad6dc042be39700'
            '660ed7291f336f2fd80a9f3599630b4e700346f8067cc23fab5c0837edf5cf7a')

prepare() {
    cd "${srcdir}"
    mv Makefile "skype4pidgin-${pkgver}/skypeweb"
}

build() {
    msg2 'Synchronizing build directory'
    rsync --recursive --times "${srcdir}/skype4pidgin-${pkgver}/skypeweb"/* "${srcdir}/build-${MSYSTEM}"
    cd "${srcdir}/build-${MSYSTEM}"
    make
}

package() {
    cd "${srcdir}/build-${MSYSTEM}"
    make DESTDIR="${pkgdir}" install
    install -Dm644 "${srcdir}/skype4pidgin-${pkgver}/skypeweb/gpl3.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/gpl3.txt"
}
